<!DOCTYPE html>
<html>
  <head>
    <title>Vue源码剖析</title>
    <script src="../../dist/vue.js"></script>
  </head>

  <body>
    <div id="demo">
      <h1>数据响应化</h1>
      <p>{{obj.foo}}</p>
      <p>{{msg}}</p>
    </div>
    <script>
      const app = new Vue({
        el: "#demo",
        // 2ob，5dep，1watcher
        data: {
          obj: { foo: "foo" },
          msg: 'hello'
        },
        mounted() {
          setTimeout(() => {
            this.obj.foo = "fooooo";
            this.msg = 'world'
          }, 1000);
        },
        watch: {
          'obj.foo'(newValue, oldValue) {
            console.log('newValue', newValue)
          },
          msg(newValue) {
            console.log(newValue)
          }
        },
      });
    </script>
  </body>
</html>
